<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.infodms.dms.common.Constant"%>
<%@page import="com.infodms.dms.bean.TtAsActivityBean"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<jsp:include page="${contextPath}/common/jsp_head_new.jsp" />
<%@taglib uri="/jstl/cout" prefix="c"%>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>服务活动管理</title>
<%
TtAsActivityBean beforeVehicle = (TtAsActivityBean) request.getAttribute("beforeVehicle");//服务活动信息-服务车辆活动范围
TtAsActivityBean afterVehicle = (TtAsActivityBean) request.getAttribute("afterVehicle");//服务活动信息-服务车辆活动范围
%>			
<% String contextPath = request.getContextPath(); %>
<script type="text/javascript">
//日历控件初始化
	function doInit()
		{
		   loadcalendar();
		}
//索赔选择
	function chickFixfee(show){
		if(document.fm.isFixfee.checked==true){
			document.fm.isClaim.checked=true;
			show.style.display ="block";
		}else {
		 show.style.display ="block";
		}
	}
	function chickClaim(show){
		if(document.fm.isClaim.checked==false&&document.fm.isFixfee.checked==true){
			document.fm.isClaim.checked=true;
		}
	}
	function fix(show){
          if(document.fm.isFixfee.checked==true){
           show.style.display ="block";
           }else{
           show.style.display ="block";
           }
    }
	function subChecked() {
		/*JS取日期之间的相差的天数*/
	      var number;
	      var endDate=document.getElementById("endDate").value;
	      var startDate=document.getElementById("startDate").value;
	      var uploadPrePeriod=document.getElementById("uploadPrePeriod").value;
	      var dt1 =  new Date(endDate.replace(/-/g,"\/"));
	      var dt2 =  new Date(startDate.replace(/-/g,"\/"));
	            if(dt1.getTime()>=dt2.getTime()){
	           number = (dt1.getTime()- dt2.getTime())/(24*60*60*1000)
	           }
	            if( '' == uploadPrePeriod || null == uploadPrePeriod){
	               MyAlert("上传总结天数不能空");
	               uploadPrePeriod.focus();
	              return false;  
	           }
			//服务活动车辆范围开始
		    var beforeVehicle =document.fm.beforeVehicle;
		    var afterVehicle =document.fm.afterVehicle;
			if(beforeVehicle.checked==false&&afterVehicle.checked==false){
				MyAlert("请选择服务活动车辆范围！");
				return false;
			}			
			//服务活动车辆范围结束
			if(!submitForm('fm')) {
				return false;
			}
			 //disableBtn($("commitBtn"));//点击按钮后，按钮变成灰色不可用;
		    MyConfirm("是否确认添加？",add);
	}
	//添加服务活动主数据信息
	function add(){
		fm.action = "<%=contextPath%>/claim/serviceActivity/ServiceActivityManage/serviceActivityManageAdd.do";
		fm.submit();
	}
	//活动类别下拉框onchange事件
	function doMySel(value){
		if(value=='<%=Constant.SERVICEACTIVITY_KIND_02%>'){
			$('isFixfee').checked = true ;
			$('isClaim').disabled = 'disabled';
			chickFixfee(show) ;
			$('isFixfee').disabled = 'disabled' ;
			$('afterVehicle').disabled= 'disabled';
			$('beforeVehicle').disabled='disabled';
			$('activityFee').value = 0 ;
			$('activityFee').readOnly = true;
		}else{
		    $('activityFee').readOnly = false;
			$('isFixfee').checked = false ;
			$('isClaim').disabled = false;
			$('isClaim').checked = false;
			chickFixfee(show) ;
			$('isFixfee').disabled = false ;
			$('afterVehicle').disabled= false;
			$('beforeVehicle').disabled=false;
		}
	}
	// 生产基地下拉框显示控制
	function showYieldly(value){	
		if(value==1)
			$('yieldly1').style.display = 'block' ;
		else
			$('yieldly1').style.display = 'none' ;
	}
</script>
</head>

<body onLoad="fix(show)">
<table cellSpacing=0 cellPadding=0 width="100%" border=0>
	<tbody>
		<tr>
			<td></td>
		</tr>
		<tr>
			<td height="30">
				<div class="navigation">
					<img src="<%=contextPath%>/img/nav.gif" />&nbsp;当前位置：售后服务管理&gt;服务活动管理&gt;服务活动管理
				</div>
			</td>
		</tr>
	</tbody>
</table>
<form method="post" name="fm" id="fm">
<table class="table_edit">
	<tr>
		<th colspan="6">
			<img class="nav" src="<%=contextPath%>/img/subNav.gif" />基本信息
		</th>
	</tr>
	<tr>
		<!--
		<td width="16%" align="right">活动编号：</td>
		<td width="28%" align="left">
		             系统自动生成(新增时不显示)<font color="red">*</font>
			  <input name="activityCode" id="activityCode" value="" type="text" class="middle_txt" datatype="0,is_digit_letter,18" > 
		</td>
		-->
		<td width="10%" align="right">活动名称：</td>
		<td width="20%">
		     <input name="activityName" id="activityName" value="" type="text" class="middle_txt" datatype="0,is_null,100">
		</td>
		<td width="10%" align="right">活动类型：</td>
		<td width="20%">
		   <script type="text/javascript">
   				genSelBoxExp("activityType",<%=Constant.SERVICEACTIVITY_TYPE%>,"",false,"short_sel","","false",'');
  		   </script>
		</td>
	</tr>
	<tr>
		<td width="10%" align="right">活动类别：</td>
		<td width="20%">
		  <script type="text/javascript">
   				genSelBoxExp2("activityKind",<%=Constant.SERVICEACTIVITY_KIND%>,"",false,"short_sel","","false",'');
  		  </script>
		</td>
		<td width="10%" align="right" >活动日期：</td>
		<td width="20%">
			<div align="left">
            	   <input name="startDate" id="t1" value="" type="text" class="short_txt" datatype="0,is_date,10" group="t1,t2" hasbtn="true" callFunction="showcalendar(event, 't1', false);"/>
               至   <input name="endDate" id="t2" value="" type="text" class="short_txt" datatype="0,is_date,10" group="t1,t2" hasbtn="true" callFunction="showcalendar(event, 't2', false);"/>
            </div>
	    </td>
	</tr>
	<tr>
		<td width="10%" align="right" >距活动结束后&nbsp;&nbsp;</td>
		<td width="20%">
			<input type="text" name="uploadPrePeriod" id="uploadPrePeriod" class="middle_txt" size="20" maxlength="4"  datatype="0,is_null,10" value="0"/>
			天内上传总结
		</td>
		<td width="10%" align="right">处理方式：</td>
		<td width="20%">
			    <script type="text/javascript">
   					genSelBoxExp("dealwith",<%=Constant.SERVICEACTIVITYDEAL_WITH%>,"",false,"short_sel","","false",'');
  		       </script>
	    </td>
	</tr>
	<tr>
		<td width="10%" align="right">单台次活动次数：</td>
		<td width="20%">
			<input type="text" class="middle_txt" name="single_num" id="single_num" datatype="0,is_digit,4" value="1"/>
		</td>
		<td width="10%" align="right">单经销商活动总次数：</td>
		<td>
			<input type="text" class="middle_txt" name="car_max" id="car_max" datatype="0,is_digit,6" />
		</td>
	</tr>
	<tr>
     	<td width="10%" align="right" >服务活动车辆范围：</td>
     	<td width="20%">
     	  <input type="checkbox" value="<%=beforeVehicle.getCodeId()%>" name="beforeVehicle" id="beforeVehicle"/>
     	  <script type='text/javascript'>
				       var beforeVehicle=getItemValue('<%=beforeVehicle.getCodeId()%>');
				       document.write(beforeVehicle) ;
		 </script>
     	 <input type="checkbox" checked value="<%=afterVehicle.getCodeId()%>" name="afterVehicle" id="afterVehicle"/>
     	 <script type='text/javascript'>
				       var afterVehicle=getItemValue('<%=afterVehicle.getCodeId()%>');
				       document.write(afterVehicle) ;
		 </script>
		 <span style="color:red">*</span>
     	</td>
     	<td width="10%" align="right">结算指向：</td>
     	<td width="20%">
     		<input type="radio" name="default" id="default" value="1" checked onclick="showYieldly(0);"/>按生产基地结算
     		<input type="radio" name="default" id="directed" value="2" onclick="showYieldly(1);"/>定向结算
     		<span id="yieldly1" style="display:none">
     			<script type="text/javascript">
					genSelBoxExp("yieldly",<%=Constant.SERVICEACTIVITY_CAR_YIELDLY%>,"",false,"short_sel","","true",'');
				</script>
     		</span>
     	</td>
	</tr>
	<tr id=show>
		<td width="10%" align="right" >活动费用：</td>
		<td width="20%">
			<input type="text" name="activityFee" id="activityFee" class="middle_txt" size="20" value="0" datatype="0,is_double,9" />
		</td>
		<td width="10%" align="right" >里程限制：</td>
		<td width="20%">
			<input type="radio" name="misage" id="a" value="1" />是
     		<input type="radio" name="misage" id="b" value="0" CHECKED/>否
     	</td>
		<!--
		<td class="table_edit_2Col_label_5Letter" >配件费用：</td>
		<td align="left">
			<input type="text" name="partFee" id="partFee" class="middle_txt" size="20" value="" datatype="0,is_double,7">
		</td>
		<td class="table_edit_2Col_label_5Letter" >工时费用：</td>
		<td align="left">
			<input type="text" name="worktimeFee" id="worktimeFee" class="middle_txt" size="20" value="" datatype="0,is_double,4">
		</td>
		-->
	</tr>
	<tr>
		<td width="10%" align="right">&nbsp;</td>
		<td width="20%">
			<input type="checkbox" name="isClaim" id="isClaim" value="0" onclick="chickClaim(show)"/>
			索赔
		</td>
		<td width="10%" align="right">&nbsp;</td>
		<td width="20%">
			<input type="checkbox" name="isFixfee" id="isFixfee" onclick="chickFixfee(show)" value="1" />
			索赔是否为固定费用
		</td>
	</tr>
	<tr>
		<td width="10%" align="right">解决方案说明：</td>
		<td colspan="3" align="left">
			<textarea name="solution" id="solution" class="SearchInput" rows="8" cols="90" datatype="0,is_null,200"></textarea>
		</td>
	</tr>	 
	<tr>
		<td width="10%" align="right">索赔申请指导：</td>
		<td colspan="3" align="left">
			<textarea name="claimGuide" id="claimGuide" class="SearchInput" rows="8" cols="90" datatype="0,is_null,200"></textarea>
		</td>
	</tr>
</table>
<br/>
<table class="table_edit">
	<tr>
		<td colspan="4" align="center">
			<input type="button" name="bt_add" class="long_btn" onclick="subChecked();" value="提交主数据" id="commitBtn"/>
		    <input type="button" name="bt_back" class="normal_btn" onclick="javascript:history.go(-1)" value="返回"/>
	    </td>
	</tr>
	<tr>
		<td colspan="4" align="center"></td>
	</tr>
</table>
</form>
</body>
</html>